const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');

module.exports = {
  css: {
    loaderOptions: {
      // 给 sass-loader 传递选项
      sass: {
        prependData: `@import '~@/scss/base/function';`,
      },
    },
  },

  transpileDependencies: ['vue-echarts', 'resize-detector'],

  devServer: {
    port: 8000,
    open: true,
    proxy: {
      '/api/': {
        // http://49.233.204.154/user/api/login
        target: 'http://49.233.204.154', //汉卿
        changeOrigin: true,
      },
    },
    before(app) {},
  },

  chainWebpack: config => {
    if (process.env.NODE_ENV === 'production') {
      config.plugin('loadshReplace').use(new LodashModuleReplacementPlugin());
    }
  },
};
